package com.liruo.learn.spring.mvc.validate;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @Author:liruo
 * @Date:2023-06-10-20:38:46
 * @Desc
 */
public class TestInitValidator implements ConstraintValidator<TestInit, Object> {
    private Object annotationValue;
    @Override
    public void initialize(TestInit testInit) {
        this.annotationValue = testInit.value();
        System.out.println("TestInitValidator init");
    }

    @Override
    public boolean isValid(Object value, ConstraintValidatorContext context) {
        System.out.printf("annotationValue=%s, value=%s\n",annotationValue, value);
        return true;
    }
}
